<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>一朵 - 我的账单</title>
  <!-- swiper-2.7css -->
    <link rel="stylesheet" href="__STATIC__/index/js/swiper/idangerous.swiper.css">
  <!-- swiper-2.7js -->
    <script src="__STATIC__/index/js/swiper/idangerous.swiper.min.js"></script>
  <!-- jquery-3.2.1引用 -->
    <script src="__STATIC__/index/js/global/jquery-3.2.1.min.js"></script>
  <!-- 阿里巴巴矢量图库 -->
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_561814_yo33l6f1qxhl4n29.css">
  <!-- 公共头部 脚部 -->
    <link rel="stylesheet" href="__STATIC__/index/css/global/global.css">
  <!-- 超过1200屏幕 -->
    <link rel="stylesheet" media="screen and (min-width: 1200px)" href="__STATIC__/index/css/bill/bill1200.css" />
  <!-- 1080-1200 -->
    <link rel="stylesheet" media="screen  and (min-width: 1080px) and (max-width: 1199px) " href="__STATIC__/index/css/bill/bill1080.css"
    />
  <!-- 960-1080 -->
    <link rel="stylesheet" media="screen  and (min-width: 960px) and (max-width: 1079px) " href="__STATIC__/index/css/bill/bill960.css"
    />
  <!-- 768-959 -->
    <link rel="stylesheet" media="screen  and (min-width: 768px) and (max-width: 959px) " href="__STATIC__/index/css/bill/bill768.css"
    />
  <!-- 568-767 -->
    <link rel="stylesheet" media="screen  and (min-width: 568px) and (max-width: 767px) " href="__STATIC__/index/css/bill/bill568.css"
    />
  <!-- 375-567 -->
    <link rel="stylesheet" media="screen  and (min-width: 375px) and (max-width: 567px) " href="__STATIC__/index/css/bill/bill375.css"
    />
  <!-- 小于375-->
    <link rel="stylesheet" media="screen  and (max-width: 374px) " href="__STATIC__/index/css/bill/bill320.css" />
  {include file="public/page_css" /}
</head>

<body>

    <div class="M">
        <div class="m-header">
            <div>
                <span onclick="go_back();">
                    <span class="iconfont icon-xiangzuo" ></span>
                    返回
                </span>
                <span>我的账单</span>
                <span>
                    {if condition="!empty($realname)"}
                        <a href="{:url('User/index')}" class="my" >
                            {$realname}
                        </a>
                    {else /}
                        <a href="{:url('Login/loginin')}">登录</a>
                        <a href="{:url('Login/register')}">注册</a>
                    {/if}
                    <a href="{:url('MyCart/my_cart')}" class="car">
                        <span class="iconfont icon-gouwuche"></span>
                        <span>{$cart_num}</span>
                    </a>
                </span>
            </div>

        </div>
        <div class="m-list">
        {foreach name="list" item="v"}
         
                {if condition="$v.chargetype eq 1"}
                <a href="{:url('User/order_detail')}?id={$v.order_id}">
            {else /}
                <a href="javascript:;" style="color:#404958;cursor:default;"">
            {/if}
                    <span>
                        {if condition="$v.chargetype eq 1"}
                            <i class="iconfont icon-gouwuche1 m-xiaofei" ></i>
                        {else /}
                            <i class="iconfont icon-3 m-chongzhi"></i>
                        {/if}
                    </span>
                    <span>
                        <p>
                            {if condition="$v.chargetype eq 1"}
                                订单消费
                            {elseif condition="$v.chargetype eq 2" /}
                                余额充值
                            {else /}
                                商品退货
                            {/if}
                        </p>
                        <p>{$v.addtime|date="Y-m-d",###}</p>
                    </span>
                    <span>
                        {if condition="$v.chargetype eq 1"}
                            {$v.amount}
                        {elseif condition="$v.chargetype eq 2" /}
                            +{$v.amount}
                        {else /}
                            +{$v.amount}
                        {/if}
                    </span>
                </a>
            <!-- </a> -->
        {/foreach}
        </a>

        <div class="m-finish">
            {if condition="$cur_page eq $all_page"}
            <p>没有更多了</p>
            <p>...</p>
            {/if}
        </div>
    </div>
    <!------------------------ PC ------------------------>

    <div class="PC">
        <!-- 公共头部 -->
        {include file="public/p_header" /}
        <!-- 公共头部结束 -->
        <div class="pc-content">
            {include file="public/p_user" /}
            <div class="PC_right">
                {include file="public/p_user_info" /}
                <div class="pc-tihuan">
                    <div class="pc-tihuan-headline">
                        <div>
                            <p>
                                <span>
                                    操作
                                </span>
                                <span>
                                    充值消费
                                </span>
                                <span>
                                    时间
                                </span>
                            </p>
                        </div>
                    </div>
                    <div class="pc-bill">
                        <!-- 循环开始 -->
                        {foreach name="list" item="v"}
                            {if condition="$v.chargetype eq 1"}
                                <a href="{:url('User/order_detail')}?id={$v.order_id}">
                            {else /}
                                <a href="javascript:;" style="color:#404958;cursor:default;"">
                            {/if}
                            <div>
                                <p>
                                    <span>
                                        {if condition="$v.chargetype eq 1"}
                                            <i class="iconfont icon-gouwuche1 pc-xiaofei"></i>
                                        {else /}
                                            <i class="iconfont icon-3 pc-chongzhi"></i>
                                        {/if}
                                        <span>
                                            {if condition="$v.chargetype eq 1"}
                                                订单消费
                                            {elseif condition="$v.chargetype eq 2" /}
                                                余额充值
                                            {else /}
                                                商品退货
                                            {/if}
                                        </span>
                                    </span>
                                    <span>
                                        {if condition="$v.chargetype eq 1"}
                                            {$v.amount}
                                        {elseif condition="$v.chargetype eq 2" /}
                                            +{$v.amount}
                                        {else /}
                                            +{$v.amount}
                                        {/if}
                                    </span>
                                    <span>
                                        {$v.addtime|date="Y-m-d",###}
                                    </span>
                                </p>
                            </div>
                            </a>
                        {/foreach}
                        <!-- 循环结束 -->
                    </div>
                </div>
            </div>
        </div>
        <div class="pc-Flip pages" style="text-align: center;">
            {$page}
        </div>
        <!-- 公共脚部  -->
        {include file="public/p_footer" /}
        <!-- 公共脚部 结束 -->

    </div>
    <div style="display:none;" id="cur_page">{$cur_page}</div>
    <div style="display:none" id="all_page">{$all_page}</div>
</body>

</html>
<script>
    $(window).scroll(function () {
        console.log($(document).scrollTop());
        console.log($(document).height());
        console.log($(window).height());
        console.log($(document).height() - $(window).height() -1);
        if ($(document).scrollTop() >= $(document).height() - $(window).height() -1) {
            var cur_page = parseInt($('#cur_page').text());       //当前页码
            var all_page = parseInt($('#all_page').text());       //当前页码
            if(all_page != cur_page){
                $.post("{:url('User/get_ajax_wallet_log')}",
                    {cur_page:cur_page},
                    function(data){
                        if(data.code == 1){
                            var html = '';
                            for(var i=0;i<data.data.length;i++){
                                var tubiao = '';
                                var leixing = '';
                                var amount = '';
                                if(data.data[i]['chargetype'] == 1){
                                    tubiao = '<i class="iconfont icon-gouwuche1 m-xiaofei" ></i>';
                                }else{
                                    tubiao = '<i class="iconfont icon-3 m-chongzhi"></i>';
                                }

                                if(data.data[i]['chargetype'] == 1){
                                    leixing = '订单消费';
                                }else if(data.data[i]['chargetype'] == 2){
                                    leixing = '余额充值';
                                }else{
                                    leixing = '商品退货';
                                }

                                if(data.data[i]['chargetype'] == 1){
                                    amount = data.data[i]['amount'];
                                }else{
                                    amount = '+'+data.data[i]['amount'];
                                }
                                html +='<div class="m-list"><div><span>'+tubiao+'</span><span><p>'+leixing+'</p><p>'+data.data[i]["add_time"]+'</p></span><span>'+amount+'</span></div></div>';
                            }
                            $('.m-finish').before(html);
                            $('#cur_page').text(data.msg);
                            if(cur_page+1 == all_page){
                                $('.m-finish').append('<p>没有更多了</p><p>...</p>');
                            }
                        }
                    }
                );

            }
        }
    });

    /**
     * 返回上一页
     */
    function go_back(){
        window.history.back();  //返回上一页
    }

    /**
     * 完善会员信息
     */
    function edit_member_info(){
        window.location.href = "{:url('User/my_center')}";
    }
</script>